﻿using MultiAxisAssembly;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 喷点胶机
{
    public partial class Form1 : UIAsideMainFrame
    {
        private ControlMaster controlMaster;
        private string formDefaultText;
        public Form1(ControlMaster controlMaster)
        {
            InitializeComponent();
            this.controlMaster = controlMaster;
            formDefaultText = this.Text;
            Page_0_HomePage HomePage = new Page_0_HomePage(controlMaster);
            HomePage.OpenProjEvent += HomePage_OpenProjEvent;
            HomePage.SaveProjEvent += HomePage_SaveProjEvent;
            Aside.CreateNode(AddPage(HomePage, Guid.NewGuid()));
            Aside.CreateNode(AddPage(new Page_1_SnapImg(controlMaster), Guid.NewGuid()));
            Aside.CreateNode(AddPage(new Page_2_EditShapeModel(controlMaster), Guid.NewGuid()));
            Aside.CreateNode(AddPage(new Page_3_XldPathEdit(controlMaster), Guid.NewGuid()));
            Aside.CreateNode(AddPage(new Page_4_IOTable(controlMaster), Guid.NewGuid()));
            //Aside.CreateNode(AddPage(new Page_5_Calib(controlMaster), Guid.NewGuid()));
        }

        private void HomePage_SaveProjEvent(string str)
        {
            this.Text = formDefaultText + "  " + str;
        }

        private void HomePage_OpenProjEvent(string str)
        {
            this.Text = formDefaultText + "  " + str;
        }

        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            controlMaster.Close();
        }
    }
}
